package com.example.web.controller;

import com.example.web.pojo.Result;
import com.example.web.pojo.UserT;
import com.example.web.pojo.dto.NewPassword;
import com.example.web.service.UserTService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/userT")
@Slf4j
public class UserTController {

    @Autowired
    UserTService userTService;

    //登录
    @PostMapping("/login")
    public Result login(@RequestBody UserT userT) {
        return userTService.login(userT);
    }

    //注册
    @PostMapping("/register")
    public Result register(@RequestBody UserT userT) {
        return userTService.register(userT);
    }

    //修改密码
    @PostMapping("/updatePassword")
    public Result updatePassword(@RequestBody NewPassword newPassword) {
        return userTService.updatePassword(newPassword);
    }

    //删除
    @DeleteMapping("/delete")
    public Result delete(String name) {
        return userTService.delete(name);
    }

}
